from controller import router
from fastapi import FastAPI
from models.category import Category
from fastapi.staticfiles import StaticFiles
from fastapi.templating import Jinja2Templates

app = FastAPI()
templates = Jinja2Templates(directory="templates")

app.include_router(router)
app.mount("/static", StaticFiles(directory="static"), name="static")


# @app.on_event("startup")
# def startup():
#     Category.insert(name="张三").execute()
#
#
# @app.on_event("shutdown")
# async def shutdown():
#     # close_database()
#     pass


@app.get("/")
async def root():
    return {"message": "Hello World"}
